<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page isELIgnored="false" %>
<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    <title>李宁体育管理系统</title>
    <link rel="shortcut icon" href="https://cdns.lining.com/shop/lining/theme/xth2/images/headfooter/favicon.ico">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	
	<link href="css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet"> 
    <link href="css/animate.min.css" rel="stylesheet">
     <link href="css/plugins/chosen/chosen.css" rel="stylesheet">
  </head>
  <body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>数据备份管理</h5>

                <!--     <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div> -->
                </div>
                <div class="ibox-content">
                    <form role="form" id="queryForm" class="form-inline">
                       	<div class="form-group">
							<label class="col-sm-4 control-label" style="margin-top: 10px">备份时间</label>
							<div class="col-sm-3">
								<input type="text" class="form-control" name="beginTime" id="beginTime" placeholder="开始时间"></input>
							</div>
							
						</div>
                        <div class="input-group">
                            <button class="btn btn-primary" type="submit" style="margin-bottom: 0px;"><i class="fa fa-search"></i>&nbsp;开始备份
                            </button>
                            <span id="error_beginTime" style="color: red"></span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- Panel Other -->


</div>


<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.6"></script>
<script src="js/jquery.validate.js"></script>
<script src="js/jquery.serializeObject.js"></script>

<!--时间选择-->
<script src="js/plugins/layer/laydate/laydate.js"></script>
<!--下拉框-->
<script src="js/plugins/chosen/chosen.jquery.js"></script>

<script>

$("#queryForm").validate({
	rules: {
		beginTime: {
			required: true,
		}
	
	},
	messages:{
		
		beginTime:{
			required: "时间不能为空"
		}
	
	},
	errorPlacement: function(error, element) {
		$( element ).closest( "form" ).find( "span[id='error_" + element.attr( "name" ) + "']" ).append( error );
	},
    onkeyup: false,
	submitHandler:function(){
		var roleForm = $("#queryForm").serializeObject();
		console.log(JSON.stringify(roleForm));
		jQuery.ajax({
			type: "post",
		    url: "<%=path%>/manager/dealDataBackUp",
		    contentType: "application/json",
		    data: JSON.stringify(roleForm),
		    beforeSend:function() {
		    	$("#progress").modal();
		    	$("#loading").html("正在备份数据，请稍候...");

		    },
		    complete:function(data) {
		    	$("#progress").modal('hide');
		    	$("#loading").html("");
		    }, 
		    success: function (data) {
		    	if(data.status=="succese"){
		    		parent.layer.msg("备份数据信息成功!",{time: 1000},function(){goBackVipActivity();});
		    	}else if(data.status=="fail"){
		    		parent.layer.msg(data.msg);			    		
		    	}
		    },
		    error: function () {
		    	parent.layer.msg("备份数据信息失败信息失败,请联系管理员!");
		    }	
		});
	}
	
}); 

var goBackVipActivity=function(){
	window.location.href="<%=basePath%>manager/toDataBackup"
}






var start = {
		elem : "#beginTime",
		format : "YYYY-MM-DD hh:mm:ss",
		max : "2099-06-16",
		istime : true,
		istoday : false,
	};
laydate(start);
   
   
 

    function CovertToDate(unittime) {
        //3.转换成js时间格式
        var jsDate = new Date(unittime).Format("yyyy-MM-dd hh:mm:ss");
     	
        return jsDate;


    }
    Date.prototype.Format = function (fmt) { //author: meizz 
        var o = {
            "M+": this.getMonth() + 1, //月份 
            "d+": this.getDate(), //日 
            "h+": this.getHours(), //小时 
            "m+": this.getMinutes(), //分 
            "s+": this.getSeconds(), //秒 
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
            "S": this.getMilliseconds() //毫秒 
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }



</script>
  </body>
</html>
